package dontCare.gwtester.client.puzzlers;

import java.util.ArrayList;
import java.util.List;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;

import dontCare.gwtester.client.tool.SourceUrl;
import dontCare.gwtester.client.tool.UnitWidget;

public class Album8 extends UnitWidget{
	private static Album8UiBinder uiBinder = GWT.create(Album8UiBinder.class);
	interface Album8UiBinder extends UiBinder<Widget, Album8> {}

	@UiField Label shadesGray;
	@UiField Label fadeBlack1;
	@UiField Label fadeBlack2;
	@UiField Label fadeBlack3;
	
	public Album8() {
		initWidget(uiBinder.createAndBindUi(this));
		shadesGray.setText(X.Y.Z);
		
		fadeBlack();
	}
	
	//Puzzler 69
	static class Xy extends X.Y{}
	private <T extends X.Y> void fadeBlack(){
		fadeBlack1.setText(((X.Y)null).Z);
		fadeBlack2.setText(Xy.Z);
		fadeBlack3.setText(T.Z);
	}

	@Override
	public List<String> getSourceUrl() {
		ArrayList<String> result = new ArrayList<String>();
		result.add(SourceUrl.genJava(Album8.class));
		result.add(SourceUrl.genUiXml(Album8.class));
		return result;
	}

	@Override
	public HTML getDescription() {
		return new HTML("《Java Puzzlers》 Chapter 8 puzzler 集合");
	}

	@Override
	public String getName() {
		return "CH.8 Album";
	}
}

//Puzzler 68
class X{
	static class Y{
		static String Z = "Black";
	}
	static C Y = new C();
}

class C{
	String Z = "White";
}
//